package com.badu.app.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.badu.app.requestvo.UserReviceRecordQueryVo;
import com.badu.app.service.IAppCouponReceiveRecordService;
import com.badu.app.vo.AppUserReviceCouponVo;
import com.badu.common.utils.R;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.mapper.SqlHelper;
import com.baomidou.mybatisplus.plugins.Page;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author astupidcoder123
 * @since 2021-01-14
 */
@Controller
@RequestMapping("/web/app/coupon/receive-record")
public class AppCouponReceiveRecordController {

	@Autowired
	private IAppCouponReceiveRecordService appCouponReceiveRecordService;

	@ResponseBody
	@GetMapping("queryUserReviceCouponRecord")
	public R queryUserReviceCouponRecord(
			@RequestParam(name = "page", required = false, defaultValue = "1") Integer page,
			@RequestParam(name = "size", required = false, defaultValue = "10") Integer size,
			UserReviceRecordQueryVo vo) {

		Page<AppUserReviceCouponVo> pageO = new Page<AppUserReviceCouponVo>(page, size);
		SqlHelper.fillWrapper(pageO,Condition.EMPTY);
		pageO.setRecords(appCouponReceiveRecordService.selectUserReviceRecord(pageO, vo));
	
		return R.ok().put("data", pageO);
	}
}
